import scrapy


class ProdocterSpider(scrapy.Spider):
    name = "prodocter"

    async def start(self):
        yield scrapy.Request('http://quotes.toscrape.com/', callback=self.parse)


    def parse(self, response):
        items = response.xpath('//div[@class="quote"]')
        for item in items:
            yield {
                'text': item.xpath('.//span[@class="text"]/text()').get().strip(),
                'author': item.xpath('.//small[@class="author"]/text()').get().strip()[1::-1],
                'tags': item.xpath('.//div[@class="tags"]/a/text()').getall(),
            }
        next_page = response.xpath('//li[@class="next"]/a/@href').get()
        if next_page:
            yield response.follow(url = next_page)
